import React from 'react'
import {get} from '../../../fetch/get.js'
import HomeAdd from '../../../components/HomeAdd'

// import './style.scss'

class Add extends React.Component{
    constructor(props){
        super(props)
        this.state ={
            data: []
        }
    }
    render() {
        return (
            <div>
                {
                this.state.data.length ? <HomeAdd data={this.state.data}></HomeAdd> : '加载中~~~'
                }
            </div>
        )
    }
    componentDidMount() {
        var result = get('/api/homeDate')
        result.then((res) => {
            return res.json()
        }).then((json) => {
            this.setState({
                data: json
            })
        })
    }
}

export default Add